<?php
	class ErrorController extends Zend_Controller_Action
	{
		function init()
		{
			$this->initView();
			$this->view->baseUrl = $this->_request->getBaseUrl();
		}
		
		public function errorAction()
	    {
			$errors = $this->_getParam('error_handler');
			
			switch ($errors->type)
			{
				case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
				case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
					// 404 error -- controller or action not found
					$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
					$error = 'ERROR 404';
					$mensaje = 'El contenido solicitado no existe o no se encuentra disponible.';
					break;
				default:
					// application error
					$this->getResponse()->setRawHeader('HTTP/1.1 500 Not Found');
					$error = 'ACCESO DENEGADO';
					$mensaje = 'No est&aacute;s identificado o no tienes permisos.';
					break;
			}
			// Clear previous content
			$this->getResponse()->clearBody();
			$this->view->tipo = $error;
			$this->view->mensaje = $mensaje;
			$this->view->headMeta()->appendHttpEquiv('Refresh', '3;'. $this->view->url(array(), null, true));
	    }
	}